<?php

class Mailer_Plugin
{

	protected $_mail = NULL;

	public function __construct()
	{
		return $this;
	}

	/**
	 * must return zend mail object
	 */
	public function getMail()
	{
		if (NULL == $this -> _mail)
		{
			if (!class_exists('Zend_Mail', FALSE))
			{
				require_once 'Zend/Mail.php';
			}
			$this -> _mail = new Zend_Mail();
		}
		return $this -> _mail;
	}

	public function compile($params)
	{
		return $params;
	}

	public function getDefaultData()
	{
		return array();
	}

	public function execute($params)
	{
		$data = $this -> compile($params);
		$mail = $this -> getMail();

		$mail -> setSubject(strtr($subject, $data));
		$mail -> setBodyHtml(strtr($bodyHtml, $data));
		$mail -> setBodyText(strtr($bodyText, $data));
	}

	/**
	 * execute template before send to member.
	 */
	public function getTemplate()
	{

	}

}
